package com.dufang.thread05SafeOrNo;

/**
 * @ClassName:Test
 * @Description 测试买票进程->线程不安全的代码，三个人买到了同一张票
 * @Author Administrator
 * @Date 2025/7/7/007 7:59
 * @Version 1.0
 **/
public class Test {
    public static void main(String[] args) {
        //线程不安全
       // MyTicketNoSafe myTicket=new MyTicketNoSafe();
        //线程安全
        MyTicketSafe myTicket=new MyTicketSafe();
        Thread t1=new Thread(myTicket,"黛玉");
        Thread t2=new Thread(myTicket,"宝玉");
        Thread t3=new Thread(myTicket,"宝钗");

        t1.start();
        t2.start();
        t3.start();
    }
}
